alpha: true, maximized: false, count: 10, metric: 'overviewFps10Alpha',
}];
+/** @returns {void} */
export async function run() {
/* eslint-disable no-await-in-loop */
- Scripting.defineScriptEvent("overviewShowStart", "Starting to show the overview");
- Scripting.defineScriptEvent("overviewShowDone", "Overview finished showing");
- Scripting.defineScriptEvent("afterShowHide", "After a show/hide cycle for the overview");
- Scripting.defineScriptEvent("applicationsShowStart", "Starting to switch to applications view");
- Scripting.defineScriptEvent("applicationsShowDone", "Done switching to applications view");
+ Scripting.defineScriptEvent('overviewShowStart', 'Starting to show the overview');
+ Scripting.defineScriptEvent('overviewShowDone', 'Overview finished showing');
+ Scripting.defineScriptEvent('afterShowHide', 'After a show/hide cycle for the overview');
+ Scripting.defineScriptEvent('applicationsShowStart', 'Starting to switch to applications view');
+ Scripting.defineScriptEvent('applicationsShowDone', 'Done switching to applications view');
// Enable recording of timestamps for different points in the frame cycle
global.frame_timestamps = true;
// We go to the overview twice for each configuration; the first time
// to calculate the mipmaps for the windows, the second time to get
// a clean set of numbers.
- if ((i % 2) == 0) {
+ if ((i % 2) === 0) {
let config = WINDOW_CONFIGS[i / 2];
await Scripting.destroyTestWindows();
let applicationsShowStart;
let applicationsShowCount = 0;
+/**
+ * @param {number} time - event timestamp
+ * @returns {void}
+ */
export function script_overviewShowStart(time) {
showingOverview = true;
finishedShowingOverview = false;
overviewFrames = 0;
}
+/**
+ * @param {number} _time - event timestamp
+ * @returns {void}
+ */
export function script_overviewShowDone(_time) {
// We've set up the state at the end of the zoom out, but we
// need to wait for one more frame to paint before we count
finishedShowingOverview = true;
}
+/**
+ * @param {number} time - event timestamp
+ * @returns {void}
+ */
export function script_applicationsShowStart(time) {
applicationsShowStart = time;
}
+/** @returns {void} */
+/**
+ * @param {number} time - event timestamp
+ * @returns {void}
+ */
export function script_applicationsShowDone(time) {
applicationsShowCount++;
- if (applicationsShowCount == 1)
+ if (applicationsShowCount === 1)
METRICS.applicationsShowTimeFirst.value = time - applicationsShowStart;
else
METRICS.applicationsShowTimeSubsequent.value = time - applicationsShowStart;
}
+/** @returns {void} */
+/**
+ * @param {number} _time - event timestamp
+ * @returns {void}
+ */
export function script_afterShowHide(_time) {
- if (overviewShowCount == 1)
+ if (overviewShowCount === 1)
METRICS.usedAfterOverview.value = mallocUsedSize;
else
METRICS.leakedAfterOverview.value = mallocUsedSize - METRICS.usedAfterOverview.value;
}
+/**
+ * @param {number} time - event timestamp
+ * @param {number} bytes - event data
+ * @returns {void}
+ */
export function malloc_usedSize(time, bytes) {
mallocUsedSize = bytes;
}
+/**
+ * @param {number} time - event timestamp
+ * @returns {void}
+ */
function _frameDone(time) {
if (showingOverview) {
- if (overviewFrames == 0)
+ if (overviewFrames === 0)
overviewLatency = time - overviewShowStart;
overviewFrames++;
// be 1 frame for a FPS computation, hence the '- 1'
let fps = (overviewFrames - 1) / dt;
- if (overviewShowCount == 1) {
+ if (overviewShowCount === 1) {
METRICS.overviewLatencyFirst.value = overviewLatency;
METRICS.overviewFpsFirst.value = fps;
- } else if (overviewShowCount == 2) {
+ } else if (overviewShowCount === 2) {
METRICS.overviewLatencySubsequent.value = overviewLatency;
}
// Other than overviewFpsFirst, we collect FPS metrics the second
// we show each window configuration. overviewShowCount is 1,2,3...
- if (overviewShowCount % 2 == 0) {
+ if (overviewShowCount % 2 === 0) {
let config = WINDOW_CONFIGS[(overviewShowCount / 2) - 1];
METRICS[config.metric].value = fps;
}
}
}
+/**
+ * @param {number} time - event timestamp
+ * @param {number} swapTime - event data
+ * @returns {void}
+ */
export function glx_swapComplete(time, swapTime) {
haveSwapComplete = true;
_frameDone(swapTime);
}
+/**
+ * @param {number} time - event timestamp
+ * @returns {void}
+ */
export function clutter_stagePaintDone(time) {
// If we aren't receiving GLXBufferSwapComplete events, then we approximate
// the time the user sees a frame with the time we finished doing drawing
},
};
+/**
+ * @param {number} milliseconds - time to wait
+ * @returns {callback}
+ */
function waitAndDraw(milliseconds) {
let cb;
- let timeline = new Clutter.Timeline({ duration: milliseconds });
+ let timeline = new Clutter.Timeline({duration: milliseconds});
timeline.start();
timeline.connect('new-frame', (_timeline, _frame) => {
return callback => (cb = callback);
}
+/**
+ * @param {object} object - emitter object
+ * @param {string} signal - signal name
+ * @returns {callback}
+ */
function waitSignal(object, signal) {
let cb;
return callback => (cb = callback);
}
+/**
+ * @returns {number}
+ */
function extractBootTimestamp() {
const sp = Gio.Subprocess.new([
'journalctl', '-b',
return result;
}
+/** @returns {void} */
export async function run() {
/* eslint-disable no-await-in-loop */
- Scripting.defineScriptEvent("desktopShown", "Finished initial animation");
- Scripting.defineScriptEvent("overviewShowStart", "Starting to show the overview");
- Scripting.defineScriptEvent("overviewShowDone", "Overview finished showing");
- Scripting.defineScriptEvent("applicationsShowStart", "Starting to switch to applications view");
- Scripting.defineScriptEvent("applicationsShowDone", "Done switching to applications view");
- Scripting.defineScriptEvent("mainViewDrawStart", "Drawing main view");
- Scripting.defineScriptEvent("mainViewDrawDone", "Ending timing main view drawing");
- Scripting.defineScriptEvent("overviewDrawStart", "Drawing overview");
- Scripting.defineScriptEvent("overviewDrawDone", "Ending timing overview drawing");
- Scripting.defineScriptEvent("redrawTestStart", "Drawing application window");
- Scripting.defineScriptEvent("redrawTestDone", "Ending timing application window drawing");
- Scripting.defineScriptEvent("collectTimings", "Accumulate frame timings from redraw tests");
- Scripting.defineScriptEvent("geditLaunch", "gedit application launch");
- Scripting.defineScriptEvent("geditFirstFrame", "first frame of gedit window drawn");
+ Scripting.defineScriptEvent('desktopShown', 'Finished initial animation');
+ Scripting.defineScriptEvent('overviewShowStart', 'Starting to show the overview');
+ Scripting.defineScriptEvent('overviewShowDone', 'Overview finished showing');
+ Scripting.defineScriptEvent('applicationsShowStart', 'Starting to switch to applications view');
+ Scripting.defineScriptEvent('applicationsShowDone', 'Done switching to applications view');
+ Scripting.defineScriptEvent('mainViewDrawStart', 'Drawing main view');
+ Scripting.defineScriptEvent('mainViewDrawDone', 'Ending timing main view drawing');
+ Scripting.defineScriptEvent('overviewDrawStart', 'Drawing overview');
+ Scripting.defineScriptEvent('overviewDrawDone', 'Ending timing overview drawing');
+ Scripting.defineScriptEvent('redrawTestStart', 'Drawing application window');
+ Scripting.defineScriptEvent('redrawTestDone', 'Ending timing application window drawing');
+ Scripting.defineScriptEvent('collectTimings', 'Accumulate frame timings from redraw tests');
+ Scripting.defineScriptEvent('geditLaunch', 'gedit application launch');
+ Scripting.defineScriptEvent('geditFirstFrame', 'first frame of gedit window drawn');
await Scripting.waitLeisure();
Scripting.scriptEvent('desktopShown');
global.frame_finish_timestamp = true;
for (let k = 0; k < 5; k++)
- await Scripting.createTestWindow({ maximized: true });
+ await Scripting.createTestWindow({maximized: true});
await Scripting.waitTestWindows();
await Scripting.sleep(1000);
if (windows.length > 0)
throw new Error('gedit was already running');
- while (windows.length == 0) {
+ while (windows.length === 0) {
await waitSignal(global.display, 'window-created');
windows = app.get_windows();
}
let redrawTimes = {};
let geditLaunchTime;
+/**
+ * @param {number} time - event timestamp
+ * @returns {void}
+ */
export function script_desktopShown(time) {
let bootTimestamp = extractBootTimestamp();
METRICS.timeToDesktop.value = time - bootTimestamp;
}
+/**
+ * @param {number} time - event timestamp
+ * @returns {void}
+ */
export function script_overviewShowStart(time) {
overviewShowStart = time;
}
+/**
+ * @param {number} time - event timestamp
+ * @returns {void}
+ */
export function script_overviewShowDone(time) {
METRICS.overviewShowTime.value = time - overviewShowStart;
}
+/**
+ * @param {number} time - event timestamp
+ * @returns {void}
+ */
export function script_applicationsShowStart(time) {
applicationsShowStart = time;
}
+/**
+ * @param {number} time - event timestamp
+ * @returns {void}
+ */
export function script_applicationsShowDone(time) {
METRICS.applicationsShowTime.value = time - applicationsShowStart;
}
+/**
+ * @param {number} _time - event timestamp
+ * @returns {void}
+ */
export function script_mainViewDrawStart(_time) {
redrawTiming = 'mainView';
}
+/**
+ * @param {number} _time - event timestamp
+ * @returns {void}
+ */
export function script_mainViewDrawDone(_time) {
redrawTiming = null;
}
+/**
+ * @param {number} _time - event timestamp
+ * @returns {void}
+ */
export function script_overviewDrawStart(_time) {
redrawTiming = 'overview';
}
+/**
+ * @param {number} _time - event timestamp
+ * @returns {void}
+ */
export function script_overviewDrawDone(_time) {
redrawTiming = null;
}
+/**
+ * @param {number} _time - event timestamp
+ * @returns {void}
+ */
export function script_redrawTestStart(_time) {
redrawTiming = 'application';
}
+/**
+ * @param {number} _time - event timestamp
+ * @returns {void}
+ */
export function script_redrawTestDone(_time) {
redrawTiming = null;
}
+/**
+ * @param {number} _time - event timestamp
+ * @returns {void}
+ */
export function script_collectTimings(_time) {
for (let timing in redrawTimes) {
let times = redrawTimes[timing];
let len = times.length;
let median;
- if (len == 0)
+ if (len === 0)
median = -1;
- else if (len % 2 == 1)
+ else if (len % 2 === 1)
median = times[(len - 1) / 2];
else
median = Math.round((times[len / 2 - 1] + times[len / 2]) / 2);
}
}
+/**
+ * @param {number} time - event timestamp
+ * @returns {void}
+ */
export function script_geditLaunch(time) {
geditLaunchTime = time;
}
+/**
+ * @param {number} time - event timestamp
+ * @returns {void}
+ */
export function script_geditFirstFrame(time) {
METRICS.geditStartTime.value = time - geditLaunchTime;
}
+/**
+ * @param {number} time - event timestamp
+ * @returns {void}
+ */
export function clutter_stagePaintStart(time) {
stagePaintStart = time;
}
+/**
+ * @param {number} time - event timestamp
+ * @returns {void}
+ */
export function clutter_paintCompletedTimestamp(time) {
if (redrawTiming != null && stagePaintStart != null) {
if (!(redrawTiming in redrawTimes))